import cv2
import numpy as np
from ultralytics import YOLO

class PlateDetector:
    def __init__(self, model_path):
        self.model = YOLO(model_path)

    def detect_plates(self, image):
        """检测图像中的车牌区域"""
        results = self.model.predict(image, imgsz=640, conf=0.5)
        boxes = [box.xyxy.cpu().numpy() for box in results[0].boxes]
        return boxes
